import re
int_line='Route Port,The Maximum Transmit Unit is 1500'
match=re.search('The Maximum Transmit',int_line)
print(match)
print(match.group())
#调用group方法，得到匹配文本

#\d 匹配任何十进制数字，相当于类【0-9】
#+ 前一个字符匹配一次或者多次
#\d+  匹配一个或多个任何十进制数字
match1=re.search('The Maximum Transmit Unit is \d+',int_line)
print(match1.group())

log2= 'VlanId = 54, MacAddress = 0000-5e00-0136, Original-Port = GE0/0/1, Flapping port = GE0/0/2. '
re_template=r'VlanId = (\d+), MacAddress = (\S+), Original-Port = (\S+), Flapping port = (\S+)\.'
# \. .点是特殊字符，用\.去除特殊，表示点.
#() 小括号，表示分组/子组，这个有妙用
# \S+ 匹配一个或多个任何非空白字符
match=re.search(re_template,log2)
print(match)
print(match.group())
# print(log2)
print(match.group(1))
print(match.group(2))
print(match.group(3))
print(match.group(4))